/* GUI CONVERTED from rejecta.p (converter v1.75) Sat Aug 12 23:05:54 2000 */
/* rejecta.p - REPETITIVE                                                     */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/*F0PN*/ /*V8:ConvertMode=Maintenance                                         */
/*K1Q4*/ /*V8:RunMode=Character,Windows                                       */
/* REVISION: 7.3      LAST MODIFIED: 10/31/94   BY: WUG *GN77*                */
/* REVISION: 7.4      LAST MODIFIED: 08/25/97   BY: Todd Runkle *H1DL*        */
/* REVISION: 8.6      LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 10/25/99   BY: *N002* Bill Gates         */
/* REVISION: 9.1      LAST MODIFIED: 11/17/99   BY: *N04H* Vivek Gogte        */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb                */


/* REJECT TRANSACTION REGISTER REJECT QUANTITY SUBPROGRAM                     */

{mfdeclre.i}

define input parameter cumwo_lot as character.
define input parameter op as integer.
define input parameter from_op as integer.
define input parameter rsn_code as character.
define input parameter ophist_recid as recid.
define input parameter qty_reject as decimal.

/*N04H** {rewrsdef.i}                                                         */

if qty_reject = 0 then leave.

/*NO TRANSACTION SHOULD BE PENDING HERE*/
/*H1DL* {gprun.i ""gpistran.p"" "(input 1, input """")} */
/*N002 /*H1DL*/ {gprun.i ""gpistran.p"" "(input 1, input """")"} */

do trans:
/*GUI*/ if global-beam-me-up then undo, leave.

   find wr_route where wr_lot = cumwo_lot and wr_op = op exclusive-lock.

/*N04H** {rewrsget.i &lot=wr_lot &op=wr_op &lock=exclusive-lock}              */

   wr_qty_outque = wr_qty_outque - qty_reject.
   wr_qty_rejque = wr_qty_rejque + qty_reject.
   wr_qty_cumrjct = wr_qty_cumrjct + qty_reject.

/*N04H** {rewrsput.i &lot=wr_lot &op=wr_op}                                   */

   find op_hist where recid(op_hist) = ophist_recid exclusive-lock.
   op_qty_rjct = qty_reject.
   op_rsn_rjct = rsn_code.
   op__chr02 = string(from_op).

   /*UPDATE REPETITIVE SCHEDULE*/
   {gprun.i ""reupdsch.p""
   "(input cumwo_lot, input op, input (- qty_reject))"}
/*GUI*/ if global-beam-me-up then undo, leave.

end.
/*GUI*/ if global-beam-me-up then undo, leave.

